const KoaRouter = require("@koa/router")
const { verifyAuth } = require("../middleware/login.middleware")
const momentController = require("../controller/moment.controller")
const { verifyPermission } = require("../middleware/permission.middleware")

const momentRouter = new KoaRouter({ prefix: "/moment" })

// 新增动态
momentRouter.post("/", verifyAuth, momentController.create)
// 删除动态
momentRouter.delete(
  "/:momentId",
  verifyAuth,
  verifyPermission,
  momentController.remove
)
// 修改动态
momentRouter.patch(
  "/:momentId",
  verifyAuth,
  verifyPermission,
  momentController.update
)
// 查询动态
momentRouter.get("/", momentController.list)
momentRouter.get("/:momentId", momentController.detail)

module.exports = momentRouter
